Telegram Group & Telegram Channel
🕕 Задача по Java: Что будет выведено?


public class Main {
public static void main(String[] args) {
Integer a = 127;
Integer b = 127;
Integer c = 128;
Integer d = 128;

System.out.println(a == b); // ?
System.out.println(c == d); // ?
}
}


Варианты:
A) true, true
B) true, false
C) false, true
D) false, false

Правильный ответ: B

Объяснение:
Java кэширует объекты Integer в диапазоне -128 ... 127.
a == b — то же значение и тот же объект.
c == d — разные объекты вне кэша. Используй .equals() для сравнения!



tg-me.com/java_quizes/217
Create:
Last Update:

🕕 Задача по Java: Что будет выведено?


public class Main {
public static void main(String[] args) {
Integer a = 127;
Integer b = 127;
Integer c = 128;
Integer d = 128;

System.out.println(a == b); // ?
System.out.println(c == d); // ?
}
}


Варианты:
A) true, true
B) true, false
C) false, true
D) false, false

Правильный ответ: B

Объяснение:
Java кэширует объекты Integer в диапазоне -128 ... 127.
a == b — то же значение и тот же объект.
c == d — разные объекты вне кэша. Используй .equals() для сравнения!

BY Java tests


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/java_quizes/217

View MORE
Open in Telegram


Java tests Telegram | DID YOU KNOW?

Date: |

Start with a fresh view of investing strategy. The combination of risks and fads this quarter looks to be topping. That means the future is ready to move in.Likely, there will not be a wholesale shift. Company actions will aim to benefit from economic growth, inflationary pressures and a return of market-determined interest rates. In turn, all of that should drive the stock market and investment returns higher.

Why Telegram?

Telegram has no known backdoors and, even though it is come in for criticism for using proprietary encryption methods instead of open-source ones, those have yet to be compromised. While no messaging app can guarantee a 100% impermeable defense against determined attackers, Telegram is vulnerabilities are few and either theoretical or based on spoof files fooling users into actively enabling an attack.

Java tests from pl


Telegram Java tests
FROM USA